<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Exec - OS Process Manager for Erlang VM.

</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="EDoc">
</head>
<body bgcolor="white">
<div class="navbar"><a name="#navbar_top"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
<h1>Exec - OS Process Manager for Erlang VM.

</h1>
<p><b>Version:</b> 1.0 $Revision: 1.1 $ $Date: 2003/06/25 10:15:35 $
</p>
<p><b>Authors:</b> Serge Aleynikov (<a href="mailto:saleyn@gmail.com"><tt>saleyn@gmail.com</tt></a>).</p>
<p>This application implements a manager of OS processes.</p>

<h3><a name="contents">Contents</a></h3>
<ol>
  <li><a href="#fs">Features</a></li>
  <li><a href="#sp">Supported Platforms</a></li>
  <li><a href="#ar">Architecture</a></li>
  <li><a href="#sc">Configuration Options</a></li>
  <li><a href="#ex">Examples</a></li>
</ol>


<h3><a name="fs">Features</a></h3>

<du>
<li>Starting, stopping OS commands and having their process IDs.</li>
<li>Providing versatil OS command options, like working directory,
    environment setting, alternative termination command, effective
    user, process priority options.</li>
<li>Ability to link Erlang processes to OS processes (via intermediate
    Erlang Pids that are linked to an associated OS process).</li>
<li>Proper cleanup of OS processes at port program termination time.</li>
</du>
<p> </p>

<h3><a name="ar">Architecture</a></h3>
<pre>
  * - - - - - - - - - - - - *
  |   +----+ +----+ +----+  |
      |Pid1| |Pid2| |PidN|      Erlang light-weight Pids associated
  |   +----+ +----+ +----+  |   one-to-one with managed OsPids
            \   |   /
  |          \  |  /        |
              \ | / (links)
  |         +------+        |
            | exec |            Exec application running in Erlang VM
  |         +------+        |
   Erlang VM    |
  * - - - - - - + - - - - - *
                |
          +-----------+
          | exec-port |         Port program (separate OS process)
          +-----------+
           /    |    \
          /     |     \
    +------+ +------+ +------+
    |OsPid1| |OsPid2| |OsPidN|  Managed Child OS processes
    +------+ +------+ +------+
</pre>

<h3><a name="sp">Supported Platforms</a></h3>

<p>Currently the project only supports Linux operating system.</p>

<h3><a name="sc">Configuration Options</a></h3>

<p>See description of <a href="exec.html#type-exec_options"><code>exec:exec_options()</code></a> type.</p>

<h3><a name="ex">Examples</a></h3>
<pre>
1&gt; exec:start([]).                          % Start the port program.
{ok,&lt;0.32.0&gt;}
2&gt; exec:run_link("exec sleep 1000", []).    % Run a shell command to sleep for 1000s.
{ok,&lt;0.34.0&gt;,23584}
3&gt; exec:stop(23584).                        % Kill the shell command.
ok                                          % Note that this could also be accomplished
                                            % by doing exec:stop(pid(0,34,0)).

** exception error: {exit_status,15}        % Our shell died because we linked to the
                                            % shell process via exec:run_link/2.

4&gt; exec:status(15).                         % Examine the exit status.
{signal,15,false}                           % The program got SIGTERM signal and produced
                                            % no core file.
</pre>

<hr>
<div class="navbar"><a name="#navbar_bottom"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
<p><i>Generated by EDoc, Aug 20 2008, 12:40:47.</i></p>
</body>
</html>
